home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #2 / Amiga Plus CD - 1995 - No. 2.iso / internet / faq / englisch / comp.windows.x-performance < prev    next >
Encoding:
Text File  |  1995-04-11  |  31.5 KB  |  754 lines

  1. Archive-name: x-faq/speedups
  2. Last-modified: 1995/01/17
  3.  
  4. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5.     HOW TO MAXIMIZE THE PERFORMANCE OF X -- monthly posting
  6. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7.         Compiled by Art Mulder (art@cs.ualberta.ca)
  8.  
  9.   More RAM, Faster CPU's, More disk space, Faster Ethernet....  These
  10.   are the standard responses you hear when you ask how to improve the
  11.   performance of your workstation.
  12.  
  13.   Well, more hardware isn't always an option, and I wonder if more
  14.   hardware is always even a necessity.
  15.  
  16.   This "FAQ" list is a collection of suggestions and ideas from
  17.   different people on the net on how you can the best possible
  18.   performance from X Windows on your workstation, WITHOUT PURCHASING
  19.   MORE HARDWARE.
  20.  
  21.   Performance is a highly subjective issue.  The individual user must
  22.   balance `speed' versus `features' in order to come to a personal
  23.   decision.  Therefore this document can be be expected to contain many
  24.   subjective opinions in and amongst the objective facts.
  25.  
  26.   This document is specifically concerned with X.  There are of course
  27.   many other factors that can affect the performance of a workstation.
  28.   However, they are outside the scope of this document.
  29.  
  30.     [ People seriously interested in the whole area of system
  31.     performance, might want to look at the O'Reilly Nutshell Handbook
  32.     "System Performance Tuning" by Mike Loukides.  IMHO, it contains a
  33.     well-written, comprehensive treatment of system performance.  I
  34.     refer to it a lot.  I'm unaware of any other similar books.  --ed.]
  35.  
  36. -----------------
  37. Table of Contents
  38. -----------------
  39.   0. Introduction & Administrivia
  40.   1. Window Managers
  41.   2. The X Server
  42.        Which Server?
  43.        Locking the Server into RAM?
  44.        Starting your Server
  45.        Fonts
  46.        About the Resources File
  47.        Define Your Display Properly
  48.   3. Clients
  49.        A Better Clock for X
  50.        A Better Terminal Emulator for X
  51.        Other Client Comments
  52.        Tuning your client
  53.   4. Miscellaneous Suggestions
  54.        Pretty Pictures
  55.        A Quicker Mouse
  56.        Programming Thoughts
  57.        Say What!?
  58.   5. Other Sources of Information
  59.        The "Other X FAQ"
  60.        Books & etc.
  61.   6. Author & Notes
  62.   
  63. ! = changed since last issue.
  64. * = new since last issue.
  65.  
  66. -----------------------------
  67. Introduction & Administrivia
  68. -----------------------------
  69.  
  70.   This document is posted each month, on or around the 15th, to the
  71.   Usenet news groups comp.windows.x, news.answers, and comp.answers.
  72.   If you are reading a copy of this FAQ which is more than a few
  73.   months old (see the "Last-modified" date above) you should probably
  74.   locate the latest edition, since the information may be outdated.
  75.  
  76.   If you do not know how to get those newsgroups and/or your site does
  77.   not receive them and/or this article has already expired, you can
  78.   retrieve this FAQ from an archive site.
  79.  
  80.   There exist several usenet FAQ archive sites.  To find out more about
  81.   them and how to access them, please see the "Introduction to the
  82.   *.answers newsgroups" posting in news.answers.
  83.  
  84.   The main FAQ archive is at rtfm.mit.edu.  This document can be found
  85.   there in /pub/usenet/news.answers/x-faq/speedups.  If you do not have
  86.   access to anonymous ftp, you can retrieve it by sending a mail
  87.   message to mail-server@rtfm.mit.edu with the command "send
  88.   usenet/news.answers/x-faq/speedups" in the message body.
  89.  
  90.   In addition, this FAQ is available at ftp.x.org (and it's mirror
  91.   sites) in /contrib/faqs/speedup-x-faq.  Most X FAQs are there.
  92.  
  93. ---------------
  94. Window Managers
  95. ---------------
  96.  
  97.   There are a lot of window managers out there, with lots of different
  98.   features and abilities.  The choice of which to use is by necessity a
  99.   balancing act between performance and useful features.  At this
  100.   point, most respondents have agreed upon "twm" as the best candidate
  101.   for a speedy window manager. 
  102.  
  103.   A couple of generic tricks you can try to soup up your window manger,
  104.   is turning off unnecessary things like "zooming" and "opaque move".
  105.   Also, if you lay out your windows in a tiled manner, you reduce the
  106.   amount of cpu power spent in raising and lowering overlapping
  107.   windows.                           Joe English (joe@trystero.art.com)
  108.  
  109.   I've found that a good font for tiling is 7x13 (aka:
  110.   -misc-fixed-medium-r-normal--13-100-100-100-c-70-iso8859-1 ). It is
  111.   the biggest font I know of that I can use on my Sun (1152x900 screen)
  112.   and still get two 80 column terminal windows side-by-side on the
  113.   display with no overlap.  Other font suggestions will be accepted.
  114.  
  115. Suggestions for your consideration:
  116.  
  117.   Linux'ers and others might want a look at fvwm.  A light-weight
  118.   virtual wm, targeted at ``machines with too little memory, at laptops
  119.   on which mouse usage may be awkward, and at users who prefer the
  120.   appearance of the Motif window manager to twm ... all wm functions
  121.   can be performed w/out a mouse'' [from the README].
  122.                                    Zack Evans (zevans@nyx.cs.du.edu)
  123.  
  124.   While originally developed for Linux, fvwm will compile on a number
  125.   of different platforms.  The fvwm docs claim a memory consumption of
  126.   about 1/3 to 2/3 that of twm.
  127.  
  128. ------------ 
  129. The X Server
  130. ------------
  131.  
  132. Which Server?
  133. - - - - - - -
  134.   Make sure that your server is a proper match for your hardware.
  135.   If you have a monochrome monitor, use a monochrome X11 server.
  136.  
  137.   On my Monochrome Sun, I haven't noticed much difference between
  138.   the Xsun (colour) server and XsunMono, however it was pointed out to
  139.   me that XsunMono is about 800k smaller and therefore should contribute
  140.   to less paging.  
  141.          [ thanks to: Jonny Farringdon (j.farringdon@psychol.ucl.ac.uk),
  142.                         Michael Salmon (Michael.Salmon@eos.ericsson.se) ]
  143.  
  144.   How your server was compiled can also make a difference.  Jeff Law
  145.   (law@schirf.cs.utah.edu) advises us that on a Sun system, X should be
  146.   compiled with gcc (version 2.*) or with the unbundled Sun compiler.
  147.   You can expect to get "*very* large speedups in the server" by not
  148.   using the bundled SunOS compiler.  I assume that similar results
  149.   would occur if you used one of the other high-quality commercial
  150.   compilers on the market.
  151.  
  152. Locking the Server into RAM?
  153. - - - - - - - - - - - - - - -
  154.   It was suggested that perhaps hacking the X server so that it would
  155.   stay locked in RAM (and therefore not get paged out) might help
  156.   performances.  eg: via a call to plock().
  157.        [Eric C Claeys (ecc@eperm.att.com), Danny Backx (db@sunbim.be),
  158.     Juan D. Martin (juando@cnm.us.es)]
  159.  
  160.   Kenny Ranerup [kenny@axis.se] tried this a few years ago and
  161.   confirmed that it does work, and can give a noticeable speedup.  But,
  162.   you must be careful that your server doesn't grow too large (ie,
  163.   close to the size of your RAM).  He also makes the point that slow
  164.   interactive performace is in many cases due to client paging (paging
  165.   in libraries), and not server paging.
  166.  
  167. Starting your Server
  168. - - - - - - - - - - -
  169.   Joe English (joe@trystero.art.com) :
  170.     If you start up a lot of clients in your .xsession or whatever, sleep
  171.     for a second or two after launching each one.  After I changed my
  172.     .xclients script to do this, logging in actually took *less* time...
  173.     we have a heavily loaded system without much core, though.
  174.  
  175.   This sounds crazy, but I have confirmed that it works!  
  176.  
  177.   Warner Losh (imp@boulder.openware.com) provided me with a good
  178.   explanation of why this works, which I have summarized here:
  179.  
  180.     When you start up an X server it takes a huge amount of time to
  181.     start accepting connections.  A lot of initialization is done by
  182.     the server when it starts.  This process touches a large number of
  183.     pages.  Any other process running at the same time would fight the
  184.     server for use of the CPU, and more importantly, memory.  If you
  185.     put a sleep in there, you give the Server a chance to get itself
  186.     sorted out before the clients start up.
  187.  
  188.     Similarly, there is also a lot of initialization whenever an X
  189.     client program starts: toolkits registering widgets, resources
  190.     being fetched, programs initializing state and "databases" and so
  191.     forth.  All this activity is typically memory intensive.  Once this
  192.     initialization is done ("The process has reached a steady state"),
  193.     the memory usage typically settles down to using only a few pages.
  194.     By using sleeps to stagger the launching of your clients in your
  195.     .Xinitrc , you avoid them fighting each other for your
  196.     workstation's limited resources
  197.  
  198.   This is most definitely a "Your Mileage May Vary" situation, as there
  199.   are so many variables to be considered: available RAM, local swap
  200.   space, load average, number of users on your system, which clients
  201.   you are starting, etc.
  202.  
  203.   Currently in my .xinitrc I have a situation like:
  204.     (sleep 1; exec xclock ) &
  205.     (sleep 1; exec xbiff ) &
  206.     (sleep 1; exec xterm ) &
  207.     (sleep 1; exec xterm ) &
  208.  
  209.   I've experimented with:
  210.     (sleep 1; exec xclock ) &
  211.     (sleep 2; exec xbiff ) &
  212.     (sleep 3; exec xterm ) &
  213.     (sleep 4; exec xterm ) &
  214.  
  215.   I've even tried:
  216.     (sleep 2; exec start_X_clients_script ) &
  217.   and then in start_X_clients_script I had:
  218.     (sleep 1; exec xclock ) &
  219.     (sleep 1; exec xbiff ) &
  220.     (sleep 1; exec xterm ) &
  221.     (sleep 1; exec xterm ) &
  222.  
  223.     [ The idea with this last one was to make sure that xinit had
  224.     completely finished processing my .xinitrc, and had settled down
  225.     into a "steady state" before the sleep expired and all my clients
  226.     were launched. ]
  227.  
  228.   All of these yielded fairly comparable results, and so I just stuck
  229.   with my current setup, for its simplicity.  You will probably have to
  230.   experiment a bit to find a setup which suits you.
  231.  
  232. Fonts
  233. - - -
  234.   Loading fonts takes time and RAM.  If you minimize the number of fonts
  235.   your applications use, you'll get speed increases in load-up time.
  236.  
  237.   One simple strategy is to choose a small number of fonts (one small,
  238.   one large, one roman, whatever suits you) and configure all your
  239.   clients -- or at least all your heavily used clients -- to use only
  240.   those few fonts.  Client programs should start up quicker if their
  241.   font is already loaded into the server.  This will also conserve
  242.   server resources, since fewer fonts will be loaded by the server.
  243.                   [ Farrell McKay (fbm@ptcburp.ptcbu.oz.au),
  244.                     Joe English (joe@trystero.art.com) ]
  245.  
  246.   eg: My main xterm font is 7x13, so I also have twm set up to use 7x13
  247.   in all it's menus and icons etc.  Twm's default font is 8x13.  Since
  248.   I don't normally use 8x13, I've eliminated one font from my server.
  249.  
  250.   Oliver Jones (oj@roadrunner.pictel.com):
  251.     Keep fonts local to the workstation, rather than loading them over nfs.
  252.     If you will make extensive use of R5 scalable fonts, use a font server.
  253.  
  254. About the Resources File
  255. - - - - - - - - - - - - -
  256.  
  257.     Keep your .Xresources / .Xdefaults file small.  Saves RAM and saves
  258.     on server startup time.          Joe English (joe@trystero.art.com)
  259.  
  260.   One suggestion:
  261.  
  262.     In your .Xresources file, try putting only the minimum number of
  263.     resources that you want to have available to all of your
  264.     applications.  For example:  *reverseVideo: true
  265.  
  266.     Then, separate your resources into individual client-specific
  267.     resource files.  For example: $HOME/lib/app-defaults.  In your
  268.     .login file set the environment variable XUSERFILESEARCHPATH:
  269.  
  270.     setenv XUSERFILESEARCHPATH $HOME/lib/app-defaults/%N
  271.  
  272.     (Note:  It is easier and quicker for Xt to process
  273.     XUSERFILESEARCHPATH than XAPPLRESDIR.)
  274.  
  275.     [ The "comp.windows.x Frequently Asked Questions" FAQ contains
  276.     an excellent explanation of how this and the other main X
  277.     environment variables work.  --ed.]
  278.  
  279.     So, when xterm launches, it loads (through Xt) its resources from
  280.     .../app-defaults/XTerm.  Xdvi finds them in .../app-defaults/XDvi,
  281.     and so on and so forth.  Note that not all clients follow the same
  282.     XXxxx resource-file naming pattern.  You can check in your system
  283.     app-defaults directory (often: /usr/X11R5/lib/X11/app-defaults/) to
  284.     find the proper name, and then name your personal resource files
  285.     with the same name.
  286.  
  287.     This is all documented in the Xt Specification (pg 125 & 666).
  288.             [Thanks to: Kevin Samborn (samborn@mtkgc.com),
  289.                  Michael Urban (urban@cobra.jpl.nasa.gov),
  290.              Tom Bagli (tomb@gator.bocaraton.ibm.com),
  291.                      and Mike Long (mikel@ee.cornell.edu).
  292.          Kevin is willing mail his setup files to inquirers.]
  293.  
  294.   This method of organizing your personal resources has the following
  295.   benefits:
  296.  
  297.     - Easier to maintain / more usable.
  298.  
  299.     - Fewer resources are stored in the X server in the RESOURCE_MANAGER
  300.       property.  As a side benefit your server may start fractionally
  301.       quicker, since it doesn`t have to load all your resources.
  302.  
  303.     - Applications only process their own resources, never have to sort
  304.       through all of your resources to find the ones that affect them.
  305.  
  306.   It also has drawbacks:
  307.  
  308.     - the application that you are interested in has to load an
  309.       additional file every time it starts up.  This doesn't seem to
  310.       make that much of a performance difference, and you might
  311.       consider this a huge boon to usability.  If you are modifying an
  312.       application's resource database, you just need to re-run the
  313.       application without having to "xrdb" again.
  314.  
  315.     - xrdb will by default run your .Xresources file through cpp.  When
  316.       your resources are split out into multiple resource files and
  317.       then loaded by the individual client programs, they will not.
  318.       WATCH OUT FOR THIS!!
  319.  
  320.       I had C style comments in my .Xresources file, which cpp stripped
  321.       out.  When I switched to this method of distributed resource
  322.       files I spent several frustrating days trying to figure out why
  323.       my clients were not finding their resources.  Xt did *NOT*
  324.       provide any error message when it encountered the C style
  325.       comments in the resource files, it simply, silently, aborted
  326.       processing the resource file.
  327.  
  328.       The loss of preprocessing (which can be very handy, e.g. ``#ifdef
  329.       COLOR'' ...) is enough to cause some people to dismiss this
  330.       method of resource management.
  331.  
  332.     - You may also run into some clients which "break the rules".  For
  333.       example, neither Emacs (18.58.3) nor Xvt (1.0) will find their
  334.       resources if they are anywhere other than in .Xresources.
  335.  
  336.       This is because emacs (and presumably, Xvt) are not Xt based
  337.       applications.  They are coded to use Xlib directly.
  338.       XUSERFILESEARCHPATH and XAPPLRESDIR are Xt features.
  339.                  Larry Williamson (larry@witch.mitra.com)
  340.  
  341.     - when starting up a client on a machine that does not share files
  342.       with the machine where your resources are stored, your client
  343.       will not find its resources.  Loading all your resources into the
  344.       server will guarantee that all of your clients will always find
  345.       their resources.            Casey Leedom (casey@gauss.llnl.gov)
  346.  
  347.   A possible compromise that I have tried, is to put resources for all
  348.   my heavily used clients (eg: xterm) into my .Xresources file, and to
  349.   use the "separate resources files" method for clients that I seldom
  350.   use.
  351.  
  352. Define Your Display Properly
  353. - - - - - - - - - - - - - - -
  354.  
  355.   Client programs are often executed on the same machine as the
  356.   server.  In that situation, rather than setting your DISPLAY
  357.   environment variable to "<hostname>:0.0", where <hostname> is the
  358.   name of your workstation, you should set your DISPLAY variable to
  359.   "unix:0.0" or ":0.0".  By doing this you access optimized routines
  360.   that know that the server is on the same machine and use a shared
  361.   memory method of transferring requests.
  362.             [thanks to Patrick J Horgan (pjh70@ras.amdahl.com)]
  363.  
  364.   See the _DISPLAY NAMES_ section of the X(1) man page for further
  365.   explanation of how to properly set your display name.
  366.  
  367.   "I don't think it's stock MIT, but (at least) Data General and HP
  368.   have libraries that are smart enough to use local communication even
  369.   when the DISPLAY isn't set specially."
  370.                   Rob Sartin (88opensi!sartin@uunet.UU.NET)
  371.  
  372.   [Jody Goldberg (jody@algorithmics.com) sent me an Xlib patch to
  373.   change stock R5 to use local communication even if DISPLAY is not
  374.   properly set.  I don't want to get in the business of distributing or
  375.   trying to juggle non-MIT patches and so have elected not to include
  376.   it here.  Hopefully MIT will apply this minor (~8 lines) patch
  377.   themselves.  In the meantime, if you want to try it yourself, email
  378.   Jody.  --ed.]
  379.  
  380. -------
  381. Clients
  382. -------
  383.  
  384.   If you only have a few megabytes of Ram then you should think
  385.   carefully about the number of programs you are running.  Think also
  386.   about the _kind_ of programs you are running.  For example:  Is there
  387.   a smaller clock program than xclock?
  388.  
  389.   Unfortunately, I haven't really noticed that programs advertise how
  390.   large they are, so the onus is on us to do the research and spread
  391.   the word.
  392.  
  393.   [ Suggestions on better alternatives to the some of the standard
  394.   clients (eg: Xclock, Xterm, Xbiff) are welcome.  --ed.]
  395.  
  396.   I've received some contradictory advice from people, on the subject
  397.   of X client programs.  Some advocate the use of programs that are
  398.   strictly Xlib based, since Xt, Xaw and other toolkits are rather
  399.   large.  Others warn us that other applications which you are using
  400.   may have already loaded up one or more of these shared libraries.  In
  401.   this case, using a non-Xt (for example) client program may actually
  402.   _increase_ the amount of RAM consumed.
  403.  
  404.   The upshot of all this seems to be: Don't mix toolkits.  That is, try
  405.   and use just Athena clients, or just Xview clients (or just Motif
  406.   clients, etc).  If you use more than one, then you're dragging in
  407.   more than one toolkit library.
  408.  
  409.   Know your environment, and think carefully about which client
  410.   programs would work best together in that environment.
  411.  
  412.         [Thanks to: Rob Sartin (88opensi!sartin@uunet.UU.NET),
  413.     Duncan Sinclair (sinclair@dcs.gla.ac.uk | sinclair@uk.ac.gla.dcs) ]
  414.  
  415. A Better Clock for X
  416. - - - - - - - - - - -
  417.  
  418. 1) xcuckoo
  419.    suggested by: Duncan Sinclair (sinclair@dcs.gla.ac.uk)
  420.    available: on export.lcs.mit.edu
  421.  
  422.    Xcuckoo displays a clock in the title bar of *another* program.
  423.    Saves screen real estate.
  424.  
  425. 2) mclock
  426.    suggested by: der Mouse (mouse@Lightning.McRCIM.McGill.EDU)
  427.    available: larry.mcrcim.mcgill.edu (132.206.1.1) in /X/mclock.shar
  428.  
  429.    Non Xt-based.  Extensively configurable.  it can be made to look
  430.    very much like MIT oclock, or mostly like xclock purely by changing
  431.    resources.
  432.  
  433.   Of course, the ultimate clock --- one that consumes no resources, and 
  434.   takes up no screen real estate --- is the one that hangs on your wall.
  435.   :-) 
  436.  
  437. A Better Terminal Emulator for X
  438. - - - - - - - - - - - - - - - - -
  439.  
  440.   From the README file distributed with xterm:
  441.  
  442.   +-----
  443.   |         Abandon All Hope, Ye Who Enter Here
  444.   |
  445.   | This is undoubtedly the most ugly program in the distribution.
  446.   | ...
  447.   +-----
  448.  
  449.   Ugly maybe, but at my site it's still the most used.  I suspect that
  450.   xterm is one of the most used clients at many, if not most sites.
  451.   Laziness?  Isn't there a better terminal emulator available?  See
  452.   below.
  453.  
  454.   If you must use xterm, you can try reducing the number of saveLines
  455.   to reduce memory usage.  [ Oliver Jones (oj@roadrunner.pictel.com),
  456.            Jonny Farringdon (j.farringdon@psychol.ucl.ac.uk) ]
  457.  
  458. 1) Xvt
  459.    Suggested by: Richard Hesketh (rlh2@ukc.ac.uk)
  460.    Author: John D. Bovey (jdb@ukc.ac.uk)
  461.    Available: export.lcs.mit.edu in /contrib/xvt-1.0.tar.Z
  462.  
  463.    [From the README file] "Xvt is an X terminal-emulator that is
  464.    designed to be more or less compatible with xterm while using much
  465.    less swap space.  It is mainly intended for use at sites which use
  466.    large numbers of X terminals but may also be useful on single
  467.    workstations that are short of memory.  On a [SunOS 4.1.* Sparc], an
  468.    initially invoked xvt uses about 1/3 megabyte of swap while xterm
  469.    uses about 1.3 megabytes (obtained by running pstat rather than ps
  470.    which seems to give unreliable size figures on SPARCs).  The main
  471.    way that xvt achieves its small size is by avoiding the use of the X
  472.    toolkit."
  473.  
  474.    Since it is a partial 'clone' of xterm, you don't have to rename
  475.    your resources, as xvt pretends to be "XTerm".  In it's current
  476.    version, you cannot bind keys as you can in xterm.  I've heard that
  477.    there are versions of xvt with this feature, but I've not found any
  478.    yet.
  479.  
  480.    UPDATE (Oct 1993):  John Bovey tells me that a new version of xvt is
  481.    in the works that should have some of the most frequently missed
  482.    xterm features.
  483.  
  484.    There have been some conflicting opinions aired over xvt vs. xterm.
  485.    Different sites with different needs will likely have to do
  486.    their own evaluation.  Caveat Emptor, your mileage may vary.
  487.  
  488.    I have seen hard data from J.Bovey showing how xvt does in fact
  489.    require less swap space than xterm.  However, both of us would still
  490.    like to see any other benchmarks that people can provide comparing
  491.    the two.  (eg: How much RAM each occupies, relative speed of each.)
  492.  
  493. 2) rxvt
  494.    Suggested by: Zack Evans (zevans@nyx.cs.du.edu)
  495.    Author: Rob Nation (nation@rocket.sanders.lockheed.com)
  496.  
  497.    Apparently a stripped down Linux port of xvt, with some 
  498.    minor modifications. 
  499.  
  500. 3) mterm
  501.    Suggested by/Author: der Mouse (mouse@Lightning.McRCIM.McGill.EDU)
  502.    Available: larry.mcrcim.mcgill.edu (132.206.1.1) in
  503.      /X/mterm.src/mterm.ball-o-wax.
  504.  
  505.    "I also have my own terminal emulator.  Its major lack is
  506.    scrollback, but some people like it anyway."
  507.  
  508. Other Client Comments
  509. - - - - - - - - - - -
  510.   When using the xlock screen locking client, the "qix" mode is
  511.   much more lightweight than the default mode.  
  512.                  [Q. Alex Zhao (azhao@cc.gatech.edu)]
  513.  
  514.   I can confirm the previous report from personal experience  here.  In
  515.   a lab full of ~20 sun 3/80's all running the Xkernel software, the
  516.   subnet was getting regularly clobbered.  This was tracked down to
  517.   students running xlock.  Since these machines are all xterminals, the
  518.   actual xlock program runs remotely, and generates a scary amount of
  519.   network traffic to draw the default 'swarm' pictures on the screen.
  520.   We have removed this program and replaced it with a much simpler
  521.   screen locking program which simply blanks the screen.        [ed.]
  522.  
  523.   A suggestion: xtrlock, by Ian Jackson <ijackson@nyx.cs.du.edu>
  524.   It is very small (about 16k running), and doesn't produce any traffic
  525.   while locked. Drawback: It doesn't make your screen invisible.
  526.               [ Klamer Schutte (klamer@ph.tn.tudelft.nl) ]
  527.  
  528.   An improved xbiff: Xbuffy.  It can watch multiple mailboxes and can
  529.   do a pop up showing the From and Subject line of incoming mail.
  530.   Xbiff doesn't eat much memory and Xbuffy tends to be about the same
  531.   (on the RS/6000, xbuffy tends use just a little less memory).  It is
  532.   in the contrib directory on ftp.x.org.
  533.                                [ Bill Pemberton (wfp5p@virginia.edu) ]
  534.  
  535. Tuning your client
  536. - - - - - - - - - -
  537.  
  538.   Suggestions on how you can tune your client programs to work faster.
  539.  
  540.   From Scott Barman (scott@asd.com) comes a suggestion regarding Motif
  541.   Text Field Widgets:
  542.  
  543.     I noticed that during data entry into Motif text field widgets, I
  544.     was getting a slight lag in response to some keystrokes,
  545.     particularly the initial one in the field.  Examining the what was
  546.     going on with xscope I found it.  It seems that when the resource
  547.     XmNblinkRate is non-zero and the focus is on a text field widget
  548.     (or even just a text widget) the I-beam cursor will blink.  Every
  549.     time the cursor appears or disappears in those widgets, the widget
  550.     code is making a request to the server (CopyArea).  The user can
  551.     stop this by setting the resource XmNblinkRate to 0.  It is not
  552.     noticeable on a 40MHz SPARC, but it does make a little difference
  553.     on a [slower system].
  554.  
  555.   This specific suggestion can probably be applied in general to lots
  556.   of areas.  Consider your heavily used clients, are there any minor
  557.   embellishments that can be turned off and thereby save on Server
  558.   requests?
  559.  
  560. -------------------------
  561. Miscellaneous Suggestions
  562. -------------------------
  563.  
  564. Pretty Pictures
  565. - - - - - - - -
  566.   Don't use large bitmaps (GIF's, etc) as root window backgrounds.
  567.  
  568.   - The more complicated your root window bitmap, the slower the server
  569.     is at redrawing your screen when you reposition windows (or redraw,
  570.     etc)
  571.  
  572.   - These take up RAM, and CPU power.  I work on a Sun SPARC and I'm
  573.     conscious of performance issues, I can't comprehend it when I see
  574.     people with a 4mb Sun 3/60 running xphoon as their root window.
  575.  
  576.     I'll let someone else figure out how much RAM would be occupied by
  577.     having a full screen root image on a colour workstation.
  578.  
  579.   - If you're anything like me, you need all the screen real estate
  580.     that you can get for clients, and so rarely see the root window
  581.     anyway.
  582.  
  583.               [ Thanks to Qiang Alex Zhao (azhao@cs.arizona.edu) 
  584.             for reminding me of this one. --ed.]
  585.  
  586. A Quicker Mouse
  587. - - - - - - - -
  588.   Using xset, you can adjust how fast your pointer moves on the screen
  589.   when you move your mouse.  I use "xset m 3 10" in my .xinitrc file,
  590.   which lets me send my pointer across the screen with just a flick of
  591.   the wrist.  See the xset man page for further ideas and information.
  592.  
  593.   Hint: sometimes you may want to *slow down* your mouse tracking for
  594.   fine work.  To cover my options, I have placed a number of different
  595.   mouse setting commands into a menu in my window manager.  
  596.  
  597.   e.g. (for twm) :
  598.       menu "mouse settings" {
  599.         "Mouse Settings:"            f.title
  600.     "  Very Fast"                ! "xset m 7 10 &"
  601.     "  Normal (Fast)"            ! "xset m 3 10 &"
  602.     "  System Default (Un-Accelerated)"    ! "xset m default &"
  603.     "  Glacial"                ! "xset m 0 10 &"
  604.       }
  605.  
  606. Programming Thoughts
  607. - - - - - - - - - - -
  608.   Joe English (joe@trystero.art.com) :
  609.     To speed up applications that you're developing, there are tons of
  610.     things you can do.  Some that stick out:
  611.  
  612.     - For Motif programs, don't set XmFontList resources for individual
  613.       buttons, labels, lists, et. al.; use the defaultFontList or
  614.       labelFontList or whatever resource of the highest-level manager
  615.       widget.  Again, stick to as few fonts as possible.
  616.  
  617.     - Better yet, don't use Motif at all.  It's an absolute pig.
  618.  
  619.     - Don't create and destroy widgets on the fly.  Try to reuse them.
  620.       (This will avoid many problems with buggy toolkits, too.)
  621.  
  622.     - Use a line width of 0 in GCs.  On some servers this makes a HUGE
  623.       difference.
  624.  
  625.     - Compress and collapse multiple Expose events.  This can make the
  626.       difference between a fast application and a completely unusable
  627.       one.
  628.  
  629.   Francois Staes (frans@kiwi.uia.ac.be) :
  630.     Just a small remark: I once heard that using a better malloc
  631.     function would greatly increase performance of Xt based
  632.     applications since they use malloc heavily. They suggested trying
  633.     out the GNUY malloc, but I didn't find the time yet. I did some
  634.     tests on small programs just doing malloc and free, and the
  635.     differences were indeed very noticeable ( somewhat 5 times faster)
  636.  
  637.   [ Any confirmation on this from anyone?  --ed.]
  638.  
  639.   Andre' Beck (Andre_Beck@IRS.Inf.TU-Dresden.de) :
  640.  
  641.   - Unnecessary NoExpose Events.
  642.  
  643.     Most people use XCopyArea/XCopyPlane as fastest blit routines, but
  644.     they forget to reset graphics_exposures in the GC used for the
  645.     blits. This will cause a NoExpose Event every blit, that, in most
  646.     cases, only puts load onto the connection and forces the client to
  647.     run through it's event-loop again and again.
  648.  
  649.   - Thousands of XChangeGC requests.
  650.  
  651.     This "Gfx Context Switching" is also seen in most handcoded X-Apps,
  652.     where only one or few GCs are created and then heavily changed
  653.     again and again.  Xt uses a definitely better mechanism, by caching
  654.     and sharing a lot of GCs with all needed parameters. This will
  655.     remove the load of subsequent XChangeGC requests from the
  656.     connection (by moving it toward the client startup phase).
  657.  
  658. Say What!?
  659. - - - - - - 
  660.   Some contributors proposed ideas that seem right off the wall at first:
  661.  
  662.   David B. Lewis (by day: dbl@osf.org, by night: david%craft@uunet.uu.net) :
  663.     How about this: swap displays with someone else. Run all your
  664.     programs on the other machine and display locally; the other user
  665.     runs off your machine onto the other display. Goal: reduce context
  666.     switches in the same operation between client and server.
  667.  
  668.   I'm not in a situation where I can easily try this, but I have
  669.   received the following confirmation...
  670.  
  671.   Michael Salmon (Michael.Salmon@eos.ericsson.se):
  672.     I regularly run programs on other machines and I notice a big
  673.     difference. I try to run on a machine where I will reduce net usage
  674.     and usually with nice to reduce the impact of my intrusion. This
  675.     helps a lot on my poor little SS1+ with only 16 MB, it was
  676.     essential when I only had 8 MB.
  677.  
  678.   Casey Leedom (casey@gauss.llnl.gov) :
  679.     [The X11 Server and the client are] competing for the same CPU as
  680.     your server when you run it on the same machine.  Not really a
  681.     major problem, except that the X11 client and the server are in
  682.     absolute synchronicity and are context thrashing.
  683.  
  684.   Timothy H Panton (thp@westhawk.uucp) :
  685.     Firstly it relies on the fact that most CPU's are mostly idle, X's
  686.     cpu usage is bursty.  so the chances of you and your teammate
  687.     doing something cpu-intensive at the same time is small. If they
  688.     are not then you get twice the cpu+memory available for your
  689.     action.
  690.  
  691.     The second factor is that context switches are expensive, using 2
  692.     cpu's halves them, you pay a price due to the overhead of going
  693.     over the network, but this is offset in most cases by the improved
  694.     buffering of a network (typically 20k vs 4k for a pipe), allowing
  695.     even fewer context switches.
  696.  
  697. ----------------------------
  698. Other Sources of Information
  699. ----------------------------
  700.  
  701. The "Other X FAQ"
  702. - - - - - - - - -
  703.  
  704.   David B. Lewis (faq%craft@uunet.uu.net) maintains the informative and
  705.   well written "comp.windows.x Frequently Asked Questions" document.
  706.   Its focus is on general X information, while this FAQ concentrates
  707.   on performance.
  708.  
  709.   The comp.windows.x FAQ does address the issue of speed, but only with
  710.   regards to the X server.  The gist of that topic seems to be:
  711.     "Use X11R5, it is faster than R4".
  712.   (Please see the X FAQ for complete details).
  713.  
  714. Books & etc.
  715. - - - - - - -
  716.  
  717.   Volume 8 in O'Reilly's X Window System Series; ``X Window System
  718.   Administrator's Guide'' is a book that all X administrator's should
  719.   read.  (email your snailmail address to catalog@ora.com for a catalog)
  720.  
  721.   Adrian Nye (adrian@ora.com):
  722.     A lot more tips on performance are in the paper "Improving X
  723.     Application Performance" by Chris D. Peterson and Sharon Chang, in
  724.     Issue 3 of The X Resource.
  725.  
  726.     An earlier version of this paper appeared in the Xhibition 1992
  727.     conference proceedings.
  728.  
  729.     This paper is absolutely essential reading for X programmers.
  730.   [For information on The X Resource, contact paula@ora.com --ed.]
  731.  
  732. --------------
  733. Author & Notes
  734. --------------
  735.   This list is currently maintained by Art Mulder (art@cs.ualberta.ca)
  736.  
  737.   Suggestions, corrections, or submission for inclusion in this list
  738.   are gladly accepted.  Layout suggestions and comments (spelling
  739.   mistak's too! :-) are also welcome.
  740.  
  741.   Currently I have listed all contributors of the various comments and
  742.   suggestions.  If you do not want to be credited, please tell me.
  743.  
  744.   speedup-x-faq is copyright (c) 1993 by Arthur E. Mulder
  745.  
  746.   You may copy this document in whole or in part as long as you don't
  747.   try to make money off it, or pretend that you wrote it.
  748.  
  749. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  750. --
  751.  ...art mulder ( art@cs.ualberta.ca )    | "Do not be conformed to this world,
  752.  http://web.cs.ualberta.ca/~art/         |  but be transformed by the renewal
  753.  CS Dept, U of Alberta, Edmonton, Canada |  of your mind, ..."  Romans 12:2
  754.